55. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2021-05-13 09:08:39 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

55.1 Files compared

#LocationFileLast Modified
1/Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Dailydeals/Model/Dailydeal/SourceSwDealProduct.php2018-03-14 03:56:48 +0000
2/Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/code/Smartwave/Dailydeals/Model/Dailydeal/SourceSwDealProduct.php2018-10-30 13:43:44 +0000

55.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged13246
Changed1232
Inserted00
Removed00

55.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

55.4 Active regular expressions

No regular expressions were active.

55.5 Comparison detail

1 <?php 1 <?php
2 namespace Smartwave\Dailydeals\Model\Dailydeal\Source; 2 namespace Smartwave\Dailydeals\Model\Dailydeal\Source;
3  3 
4 class SwDealProduct implements \Magento\Framework\Option\ArrayInterface 4 class SwDealProduct implements \Magento\Framework\Option\ArrayInterface
5 { 5 {
6     const FIXED = 1; 6     const FIXED = 1;
7     const PERCENTAGE = 2; 7     const PERCENTAGE = 2;
8  8 
9     /** 9     /**
10      * to option array 10      * to option array
11      * 11      *
12      * @return array 12      * @return array
13      */ 13      */
14     protected $productFactory; 14     protected $productFactory;
15      15 
16      16 
17  17 
18     public function __construct( 18     public function __construct(
19         \Magento\Catalog\Model\ProductFactory $productFactory 19         \Magento\Catalog\Model\ProductFactory $productFactory
20     ) { 20     ) {
21      21 
22         $this->productFactory=$productFactory; 22         $this->productFactory=$productFactory;
23     } 23     }
24  24 
25  25 
26     public function toOptionArray() 26     public function toOptionArray()
27     { 27     {
28  28 
29         $childArray=[
];
 29 //        $childArray=[];
    30         // Temporary fix
    31         $childArray=[0];
30  32 
31         $productcollection=$this->productFactory->create()->getCollection(); 33         $productcollection=$this->productFactory->create()->getCollection();
32         $productcollection->addAttributeToSelect('*'); 34         $productcollection->addAttributeToSelect('*');
33  35 
34         foreach ($productcollection as $_product) { 36         foreach ($productcollection as $_product) {
35             if ($_product->getTypeId() == "bundle") { 37             if ($_product->getTypeId() == "bundle") {
36                 $product = $this->productFactory->create()->load($_product->getId()); 38                 $product = $this->productFactory->create()->load($_product->getId());
37                 //get all the selection products used in bundle product. 39                 //get all the selection products used in bundle product.
38                 $selectionCollection = $product->getTypeInstance(true) 40                 $selectionCollection = $product->getTypeInstance(true)
39                     ->getSelectionsCollection( 41                     ->getSelectionsCollection(
40                         $product->getTypeInstance(true)->getOptionsIds($product), 42                         $product->getTypeInstance(true)->getOptionsIds($product),
41                         $product 43                         $product
42                     ); 44                     );
43                 45 
44                  46 
45                 foreach ($selectionCollection as $proselection) { 47                 foreach ($selectionCollection as $proselection) {
46                     array_push($childArray, $proselection->getProductId()); 48                     array_push($childArray, $proselection->getProductId());
47                 } 49                 }
48             } 50             }
49         } 51         }
50          52 
51  53 
52         $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 54         $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
53         $currencySymbol=$objectManager->create('Magento\Store\Model\StoreManagerInterface'); 55         $currencySymbol=$objectManager->create('Magento\Store\Model\StoreManagerInterface');
54         $currencysymbol=$currencySymbol->getStore()->getCurrentCurrency()->getCurrencySymbol(); 56         $currencysymbol=$currencySymbol->getStore()->getCurrentCurrency()->getCurrencySymbol();
55          57 
56         $productcollection=$this->productFactory->create()->getCollection(); 58         $productcollection=$this->productFactory->create()->getCollection();
57  59 
58         $productcollection->addAttributeToSelect('*'); 60         $productcollection->addAttributeToSelect('*');
59         $productcollection->addAttributeToFilter('entity_id', ['nin'=>$childArray]); 61         $productcollection->addAttributeToFilter('entity_id', ['nin'=>$childArray]);
60  62 
61         $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 63         $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
62  64 
63         $options = ['value'=>'','label'=>'-- Select Product --']; 65         $options = ['value'=>'','label'=>'-- Select Product --'];
64         foreach ($productcollection as $product) { 66         foreach ($productcollection as $product) {
65             $productId = $product->getId(); //this is child product id 67             $productId = $product->getId(); //this is child product id
66                      68 
67             $getproduct = $objectManager->create('Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable')->getParentIdsByChild($productId); 69             $getproduct = $objectManager->create('Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable')->getParentIdsByChild($productId);
68  70 
69             if (isset($getproduct[0])) { 71             if (isset($getproduct[0])) {
70                 $productcollection1=$this->productFactory->create()->getCollection(); 72                 $productcollection1=$this->productFactory->create()->getCollection();
71  73 
72                  $productcollection1->addFieldToSelect('*'); 74                 $productcollection1->addFieldToSelect('*');
73  75 
74                  $productcollection1->addFieldToFilter('entity_id', ['eq'=>$getproduct[0]]); 76                 $productcollection1->addFieldToFilter('entity_id', ['eq'=>$getproduct[0]]);
75                77 
76                 $sku=$productcollection1->getFirstItem()->getSku(); 78                 $sku=$productcollection1->getFirstItem()->getSku();
77                 $name=$productcollection1->getFirstItem()->getName() ; 79                 $name=$productcollection1->getFirstItem()->getName() ;
78                 $price=$product->getFinalPrice(); 80                 $price=$product->getFinalPrice();
79                 $id=$productcollection1->getFirstItem()->getId(); 81                 $id=$productcollection1->getFirstItem()->getId();
80             } else { 82             } else {
81                 if ($product->getTypeId() == "bundle") { 83                 if ($product->getTypeId() == "bundle") {
82                     $bundleprice=[]; 84                     $bundleprice=[];
83  85 
84                     $sku=$product->getSku(); 86                     $sku=$product->getSku();
85                     $name=$product->getName(); 87                     $name=$product->getName();
86                     $id=$product->getId(); 88                     $id=$product->getId();
87                     89 
88  90 
89                     $bundleproduct = $this->productFactory->create()->load($product->getId()); 91                     $bundleproduct = $this->productFactory->create()->load($product->getId());
90                     //get all the selection products used in bundle product. 92                     //get all the selection products used in bundle product.
91                     $selectionCollection = $bundleproduct->getTypeInstance(true) 93                     $selectionCollection = $bundleproduct->getTypeInstance(true)
92                         ->getSelectionsCollection( 94                         ->getSelectionsCollection(
93                             $bundleproduct->getTypeInstance(true)->getOptionsIds($bundleproduct), 95                             $bundleproduct->getTypeInstance(true)->getOptionsIds($bundleproduct),
94                             $bundleproduct 96                             $bundleproduct
95                         ); 97                         );
96                     98 
97                      99 
98                     foreach ($selectionCollection as $proselection) { 100                     foreach ($selectionCollection as $proselection) {
99                         array_push($bundleprice, $proselection->getFinalPrice()); 101                         array_push($bundleprice, $proselection->getFinalPrice());
100                     } 102                     }
101  103 
102                     $price=min($bundleprice); 104                     $price=min($bundleprice);
103                 } elseif ($product->getTypeId() == "grouped") { 105                 } elseif ($product->getTypeId() == "grouped") {
104                     $groupedprice=[]; 106                     $groupedprice=[];
105  107 
106                      $groupedproduct = $this->productFactory->create()->load($product->getId()); 108                     $groupedproduct = $this->productFactory->create()->load($product->getId());
107                      $associatedProducts =$groupedproduct->getTypeInstance()->getAssociatedProducts($groupedproduct); 109                     $associatedProducts =$groupedproduct->getTypeInstance()->getAssociatedProducts($groupedproduct);
108                     foreach ($associatedProducts as $_item) { 110                     foreach ($associatedProducts as $_item) {
109                         array_push($groupedprice, $_item->getFinalPrice()); 111                         array_push($groupedprice, $_item->getFinalPrice());
110                     } 112                     }
111                            113 
112  114 
113                     $sku=$product->getSku(); 115                     $sku=$product->getSku();
114                     $name=$product->getName(); 116                     $name=$product->getName();
115                     $id=$product->getId(); 117                     $id=$product->getId();
116                     $price=min($groupedprice); 118                     $price=min($groupedprice);
117                 } elseif ($product->getvisibility() !=1) { 119                 } elseif ($product->getvisibility() !=1) {
118                     $sku=$product->getSku(); 120                     $sku=$product->getSku();
119                     $name=$product->getName(); 121                     $name=$product->getName();
120                     $id=$product->getId(); 122                     $id=$product->getId();
121                     $price=$product->getFinalPrice(); 123                     $price=$product->getFinalPrice();
122                 } 124                 }
123             } 125             }
124  126 
125              127 
126             if ($price != 0) { 128             if ($price != 0) {
127                 $options[] = 129                 $options[] =
128                 [ 'value'=>$sku, 130                     [ 'value'=>$sku,
129                 'label'=>"ID:".$id."  ".$name."- ".$currencysymbol."".round($price, 2)." " 131                         'label'=>"ID:".$id."  ".$name."- ".$currencysymbol."".round($price, 2)." "
130                 ]; 132                     ];
131             } 133             }
132         } 134         }
133  135 
134         $unique = array_map("unserialize", array_unique(array_map("serialize", $options))); 136         $unique = array_map("unserialize", array_unique(array_map("serialize", $options)));
135  137 
136         return $unique; 138         return $unique;
137     } 139     }
138 } 140 }